package com.example.demo.Controller;

import com.example.demo.Entity.User;
import com.example.demo.Service.UserFeignInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController

public class UserController {

    @Resource
    private UserFeignInterface userFeignInterface;

    @GetMapping("/getall")
    public List<User> getAll(){
        return userFeignInterface.getAllUsers();
    }

    @GetMapping("/getuser")
    public User getUserById(@RequestParam("id") int id){
        return userFeignInterface.getUserById(id);
    }

    @GetMapping("/count")
    public int count(){
        return userFeignInterface.count();
    }
}
